package cn.bs.busuo.account.controller;

import cn.bs.busuo.account.service.IPermissionService;
import cn.bs.busuo.common.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "4.景点管理员")
@RequestMapping("/permission")
public class PermissionController {
    @Autowired
    private IPermissionService permissionService;

    @ApiOperationSupport(order = 100)
    @ApiOperation("添加管理员")
    @PostMapping("/insert")
    private JsonResult insert(Long id) {
        permissionService.insertById(id);
        return JsonResult.ok();
    }

    @ApiOperationSupport(order = 200)
    @ApiOperation("删除管理员")
    @PostMapping("/delect")
    private JsonResult delect(Long id) {
        permissionService.deleteById(id);
        return JsonResult.ok();
    }

    @ApiOperationSupport(order = 300)
    @ApiOperation("添加工作人员")
    @PostMapping("/addOperator")
    private JsonResult addOperator(Long id) {
        permissionService.addOperator(id);
        return JsonResult.ok();
    }

    @ApiOperationSupport(order = 400)
    @ApiOperation("删除工作人员")
    @PostMapping("/delectOperator")
    private JsonResult delectOperator(Long id) {
        permissionService.delectOperator(id);
        return JsonResult.ok();
    }
}
